home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1991-09-09 | 21.1 KB | 892 lines |
- Rem ---------------------------------------------------------
- Rem - TAME (Total Amiga Map Editor) -
- Rem - -
- Rem - Programmed by Aaron Fothergill -
- Rem - (c) Mandarin / Jawx 1990 -
- Rem ---------------------------------------------------------
- Rem
- Rem READ THIS FIRST!
- Rem
- Rem *** WARNING! Unexpanded A500 users ***
- Rem
- Rem Memory is at a premium on 1/2 meg machines and you should thus
- Rem realise that only so much data can fit into such machines.
- Rem
- Rem * For an Example of how to use the Map_Editor, load the compacted
- Rem screen "MFTiles.Abk" from the Magic Forest folder on the AMOS_DATA
- Rem disc. The Map files can then be loaded in and will show how Aaron
- Rem designed each level.
- Rem
- Rem This map editor requires a lot of work space so to avoid the
- Rem 'out of memory' errors during the running of TOME, try to respect
- Rem the following points:
- Rem
- Rem * Don't design your icons in 32 colour mode. The vast size of such
- Rem a screen simply eats a massive chunk out of memory. The picture file
- Rem 'Amospic.Iff' on the AMOS_DATA: disc is a prime example. This file
- Rem cannot be loaded and used with TOME on such a small system.
- Rem
- Rem * Make sure TOME is the first thing you run on the machine. The Amiga
- Rem breaks memory up as it is asked for. Read page 52 of your AMOS
- Rem manual for more details.
- Rem
- Rem * MXLN states the amount of tile strips that will be cut out of the
- Rem loaded IFF picture. Reduce it or enlarge to your own needs.
- MXLN=5
- Dim C(7),C2(7),C3(7),LINE$(5),BUTTON$(3)
- Screen Close 0
- If Length(2)>0
- Erase 2
- End If
- TITLEBAR
- Auto View Off
- Screen Open 1,320,90,8,Lowres
- Cls
- Screen Display 1,,48,,90
- Screen To Front 2
- Screen 1
- MAKEICONS
- Curs Off : Flash Off
- Get Palette(2)
- Screen Copy 2,0,0,320,90 To 1,0,0
- Screen Close 2
- Auto View On
- Paper 0 : Pen 1
- Menu$(1)="(IC 1)"
- Menu$(1,1)=" About..."," Tame. "
- Menu$(2)="FILE "
- Menu$(2,1)=" Load Tiles"
- Menu$(2,2)=" Load Map "
- Menu$(2,3)=" Save Map "
- Menu$(2,4)=" Quit "
- Menu$(4)="Change "
- Menu$(4,1)=" Tile Size"
- Menu$(4,2)=" Map Size "
- Menu$(4,1,1)="(IC 2:Locate 16,0)16x16" : Menu$(4,1,2)="(IC 3:Locate 32,0)32x16"
- Menu$(4,1,3)="(IC 4:Locate 16,0)16x32" : Menu$(4,1,4)="(IC 5:Locate 32,0)32x32"
- Set Menu(4,1,1) To -96,-16
- Set Menu(4,1,2) To 68,0
- Set Menu(4,1,3) To -68,20
- Set Menu(4,1,4) To 68,0
- Menu$(5)="Tools "
- Menu$(5,1)=" Draw "
- Menu$(5,2)=" Do Box "
- Menu$(5,3)=" Clear Map"
- Menu$(5,4)=" Pick Tile"
- Menu$(3)="Block "
- Menu$(3,1)=" Cut Block "
- Menu$(3,2)=" Paste Block"
- Rem
- Rem xs(),ys() arrays hold the 4 different X and Y tile sizes
- Rem blk(x,y) holds cut/paste block data up to x by y tiles
- Rem
- Dim XS(3),YS(3),BLK(31,31)
- For A=0 To 3 : Read XS(A),YS(A) : Next A
- Data 16,16,32,16,16,32,32,32
- Rem
- Rem Screen 0 is used in this program to display the map
- Rem Screen 1 is set up in medium res to display co-ordinates and to handle
- Rem the menus
- Rem Screen 2 contains the tiles stored as a screen
- Rem
- Auto View Off
- Screen Open 0,320,194,16,Lowres
- Curs Off : Flash Off
- Screen Display 0,,77,,194
- Rem load in the tile screen (2) here
- Rem the tile screen is also used as the updater screen
- XSIZE=32 : YSIZE=32
- SCW=320 : SCH=192
- Show
- Gosub LDTILES
- Hide
- Screen To Back 2
- Screen 0
- Hide On
- Get Palette(2)
- Wait Vbl
- Screen To Front 0
- Screen 0
- Curs Off : Flash Off
- If Length(6)=0
- Rem clear the map to tile 0 the hard way !
- Reserve As Work 6,260
- A=0
- Repeat
- Poke Start(6)+A*4,0
- Inc A
- Until A>243
- End If
- Rem
- Rem the first 2 words of a map give the X & Y size of the map (In Tiles)
- Doke Start(6),20 : Doke Start(6)+2,12
- TAMEVIEW[0,0,SCW/XSIZE,SCH/YSIZE,XSIZE,YSIZE]
- Rem O.K Every THING IS NOW SET UP
- Show On
- Limit Mouse
- Rem get the menus going !
- Screen 1
- Reserve Zone 4
- Set Zone 4,211,30 To 315,87
- On Menu Gosub ABOUT,FILE,BLKS,CHANGE,TLS
- On Menu On
- MO=1
- Menu On
- Screen 0
- Set Menu(1) To 0,18
- Menu Static 1
- Rem The variable UTILE contains the tile number currently in use
- UTILE=0
- Rem Whenever NM is set to anything but zero, the map will be re-drawn
- NM=1
- Auto View On
- CLRTXT
- Screen 1 : Limit Mouse
- Do
- Rem check for mouse click on map
- Rem menu will only work if mouse is at the top of the screen
- If Y Screen(Y Mouse)<=0 and MO=0 Then SETSCRN[1] : Menu On : MO=1
- If Y Screen(Y Mouse)>83 and MO=1 Then Menu Off : SETSCRN[0] : MO=0
- If Mouse Key=1 and Screen=0 Then If MDE=0 Then Gosub FXTILE Else Gosub FXBX
- If Mouse Key=2 and Screen=0 Then PICKTILE : NM=1
- Rem If nm is set then update map
- If NM=1 Then SC=Screen : DRWSCRN[0] : NM=0 : TAMEMAP[2,SCX,SCY] : Screen Copy 2 To 0 : DRWSCRN[1] : UPDATA : SETSCRN[SC]
- A$=Inkey$
- Rem Joystick and arrow key scroll controls for map
- If(Jleft(1) or Asc(A$)=29) and SCX>0 Then Dec SCX : NM=1
- If(Jright(1) or Asc(A$)=28) and SCX+320/XSIZE<MAPX Then Inc SCX : NM=1
- If(Jup(1) or Asc(A$)=30) and SCY>0 Then Dec SCY : NM=1
- If(Jdown(1) or Asc(A$)=31) and SCY+192/YSIZE<MAPY Then Inc SCY : NM=1
- Rem So does dragging map area box
- If Mouse Key=1 and Screen=1
- Gosub CHECKAREABOX
- End If
- Loop
- Rem This procedure will put the screen S into the front, and set it as
- Rem the logical screen, it will also reset the mouse limits to that screen
- CHECKAREABOX:
- Z=Mouse Zone
- If Z=4
- Rem box x,y =104x57
- T=0
- While Mouse Key<>0
- SCXO=SCX
- SCYO=SCY
- SCX=((X Screen(X Mouse)-211)*MAPX)/104.0
- SCY=((Y Screen(Y Mouse)-30)*MAPY)/57.0
- SCX=Max(0,Min(MAPX-SCW/XSIZE,SCX))
- SCY=Max(0,Min(MAPY-SCH/YSIZE,SCY))
- While Mouse Key<>0 and T<100
- Inc T
- Wend
- Ink 1
- If SCXO<>SCX or SCYO<>SCY
- X1=(SCXO*104)/MAPX
- Y1=(SCYO*57)/MAPY
- X2=X1+(SCW/XSIZE*104)/MAPX
- Y2=Y1+(SCH/YSIZE*57)/MAPY
- Bar 211+X1,30+Y1 To 211+X2,30+Y2
- X1=(SCX*104)/MAPX
- Y1=(SCY*57)/MAPY
- X2=X1+(SCW/XSIZE*104)/MAPX
- Y2=Y1+(SCH/YSIZE*57)/MAPY
- Ink 4
- Bar 211+X1,30+Y1 To 211+X2,30+Y2
- End If
- Wend
- NM=1
- End If
- Return
- Procedure DRWSCRN[S]
- Y=Y Mouse
- Screen S
- Limit Mouse
- Y Mouse=Y
- End Proc
- Procedure SETSCRN[S]
- Shared MDE
- Y=Y Mouse
- Screen S
- Screen To Front S
- Limit Mouse
- Y Mouse=Y
- If S=0
- Menu Off
- Hide On
- SETAUTO
- Else
- Show On
- Amal Freeze
- Sprite Off 8
- End If
- End Proc
- Procedure SETAUTO
- Shared MDE
- SP=1
- If MDE=1 or MDE=3
- SP=2
- End If
- If MDE=2 or MDE=4
- SP=3
- End If
- If MDE=5
- SP=4
- End If
- A$="AUtotest(Let R0=XM-X;Let R1=YM-Y;"
- A$=A$+"If R0<>RX Jump Update"
- A$=A$+"If R1<>RY Jump Update else eXit"
- A$=A$+"Update: Let RX=R0; Let RY=R1; Direct M)"
- A$=A$+"M: Move R0,R1,1 ; Jump M"
- Sprite 8,X Mouse,Y Mouse,SP
- Channel 0 To Sprite 8
- Amal 0,A$
- Amal On
- End Proc
- Rem This procedure is to update the text in the data screen
- Rem done every time the screen scrolls
- Procedure UPDATA
- Shared SCW,SCH,MULX,MULY,FILE$,REZ$,NCOLS,UTILE,XSIZE,YSIZE,MAPX,MAPY,SCX,SCY
- SCX=Max(0,Min(MAPX-SCW/XSIZE,SCX))
- SCY=Max(0,Min(MAPY-SCH/YSIZE,SCY))
- MULX=1 : MULY=1
- TS=Screen
- Screen To Back 2
- Screen 2
- Curs Off
- CLRTXT
- Paper 6
- Pen 1
- Locate 22,4 : Print "MAP"
- Pen 0
- Locate 20,5 : Print "Tp Lft"
- Locate 20,6 : Print "X:";Right$(" "+Str$(SCX),3)
- Locate 20,7 : Print "Y:";Right$(" "+Str$(SCY),3)
- Locate 21,8 : Print "Size"
- Locate 20,9 : Print "X:"+Right$(" "+Str$(MAPX),3)
- Locate 20,10 : Print "Y:"+Right$(" "+Str$(MAPY),3);
- Ink 1
- X=40-XSIZE/2
- Y=58-YSIZE/2
- Bar X,Y To XSIZE+X-1,YSIZE+Y-1
- Bar 210,29 To 316,88
- Ink 0
- Box 210,29 To 316,88
- X1=(SCX*104)/MAPX
- Y1=(SCY*57)/MAPY
- X2=X1+((320*MULX)/XSIZE*104)/MAPX
- Y2=Y1+((192*MULY)/YSIZE*57)/MAPY
- Ink 0,6
- Ink 4
- Bar 211+X1,30+Y1 To 211+X2,30+Y2
- Put Block UTILE+1,X,Y
- Paper 6 : Pen 1
- Ink 1,6
- Text 3,37,"Tile:"+Right$(" "+Str$(UTILE),3)
- Ink 0,6 : Pen 0
- Text X-(48-XSIZE)/4,Y+YSIZE+10,Right$(" "+Str$(XSIZE),2)+"x"+Right$(" "+Str$(YSIZE),2)
- Paper 6 : Pen 1
- Locate 11,5 : Print "SCREEN"
- Pen 3
- I=Instr(FILE$,":")+1
- Locate 11,6 : Print Left$(Mid$(FILE$,I)+Space$(8),8)
- Pen 0
- Locate 11,7 : Print REZ$;" Rez"
- Locate 11,8 : Print Right$(" "+Str$(NCOLS),2);" Cols"
- Screen Copy 2,0,28,320,90 To 1,0,28
- Screen TS
- End Proc
- Rem This routine waits for the mouse button to be released and then
- Rem re-does the menu bar
- Procedure OMO
- Shared NM
- While Mouse Key<>0 : Wend : Rem this waits for mouse button off
- On Menu On
- NM=1
- End Proc
- Rem Level 1 menu selection routines
- Rem About Menu
- ABOUT:
- C=Choice(2)
- CREDITS
- OMO
- Return
- Rem File Menu selector
- FILE:
- C=Choice(2)
- On C Gosub LDTILES,LDMAP,SVMAP,QUIT
- OMO
- Return
- Rem Change Menu Selector
- CHANGE:
- C=Choice(2)
- If C=1
- C2=Choice(3) : XSIZE=XS(C2-1) : YSIZE=YS(C2-1)
- GTBLCKS : Cls 0 : TAMEVIEW[0,0,SCW/XSIZE,SCH/YSIZE,XSIZE,YSIZE]
- MO=0
- End If
- If C=2 Then Gosub SIZEMAP
- OMO
- Return
- Rem blocks menu selector
- BLKS:
- C=Choice(2)
- On C Gosub CUTBLK,PASTEBLK
- OMO
- Return
- Rem Tools menu selector
- TLS:
- C=Choice(2)
- If C=1 Then MDE=0 : Rem draw mode
- If C=2 Then MDE=1 : Rem box mode (mde 2=bottom right)
- If C=3 Then Gosub CLRMAP
- If C=4 Then SETSCRN[0] : PICKTILE : SETSCRN[1]
- OMO
- Return
- Rem level 2 menu routines (called from level 1)
- BLKMDE:
- If MDE=5
- Gosub BLKSTICKER
- Else
- Gosub BLKCUTTER
- End If
- Return
- CUTBLK:
- Rem Cut a block of tiles from the map (controlled as draw box routine)
- MDE=3
- Return
- BLKCUTTER:
- Rem This routine is called from the box drawing routine (mde>0)
- If MDE=3
- BTLX=X+SCX
- BTLY=Y+SCY
- MDE=4 : SETAUTO : While Mouse Key<>0 : Wend
- Else
- MDE=5 : SETAUTO
- BLKSX=X+SCX-BTLX
- BLKSY=Y+SCY-BTLY
- If BLKSX<=0
- BLKSX=1
- End If
- If BLKSY<=0
- BLKSY=1
- End If
- A=0 : Repeat
- B=0 : Repeat
- BLK(B,A)=Peek(Start(6)+4+BTLX+B+(BTLY+A)*MAPX)
- Inc B : Until B>BLKSX
- Inc A : Until A>BLKSY
- End If
- While Mouse Key<>0 : Wend
- Return
- PASTEBLK:
- If BLKSX>0 and BLKSY>0
- MDE=5
- End If
- Return
- BLKSTICKER:
- A=0 : Repeat
- B=0 : Repeat
- Poke Start(6)+4+((SCY+Y+A) mod MAPY)*MAPX+(SCX+X+B) mod MAPX,BLK(B,A)
- Inc B : Until B>BLKSX
- Inc A : Until A>BLKSY
- NM=1
- Return
- SVMAP:
- F$=Fsel$("*.MAP","","Save a TAME map")
- If F$<>""
- Bsave F$,Start(6) To Start(6)+MAPX*MAPY+20
- End If
- Return
- LDMAP:
- F$=Fsel$("*.MAP","","Load a TAME map")
- If F$<>""
- Open In 1,F$
- L=Lof(1)
- Close 1
- Erase 6
- Reserve As Work 6,L
- Bload F$,Start(6)
- MAPX=Deek(Start(6))
- MAPY=Deek(Start(6)+2)
- S6=Start(6)+MAPX*MAPY+4
- XSIZE=Deek(S6) : YSIZE=Deek(S6+2)
- TLX=Deek(S6+4) : TLY=Deek(S6+6)
- TAMEW=Deek(S6+8) : TAMEH=Deek(S6+10)
- BRX=Deek(S6+12) : BRY=Deek(S6+14)
- TAMEVIEW[0,0,SCW/XSIZE,SCH/YSIZE,XSIZE,YSIZE]
- End If
- Return
- LDTILES:
- S=Screen
- FILE$=Fsel$("","","Select an IFF picture to load as tiles")
- If FILE$<>"" Then ICDONE=0 : Gosub LDPICCY : GTBLCKS : SETSCRN[S]
- Gosub GTREZ
- Screen Open 0,SCW,SCH,NCOLS,RZ
- Curs Off : Flash Off : Get Palette(2)
- Screen Display 0,,77,,SCH
- Screen To Front 1
- Return
- LDPICCY:
- If Upper$(Right$(FILE$,4))=".ABK"
- Load FILE$,5
- A$="" : A=0 : Repeat : A$=A$+Chr$(Peek(Start(5)-8+A)) : Inc A : Until A=8
- If A$="Pac.Pic."
- Unpack 5 To 2
- End If
- Erase 5
- Else
- Load Iff FILE$,2
- End If
- Return
- GTREZ:
- Screen To Front 2
- Screen 2
- A=Screen Base+72
- R=Deek(A)
- If Btst(15,R)
- REZ$="Hi"
- RZ=Hires
- Else
- REZ$="Low"
- RZ=Lowres
- End If
- NCOLS=Deek(A+24)
- SCW=Deek(A+4)
- SCH=Deek(A+6)
- Screen To Back 2
- Return
- QUIT:
- While Mouse Key<>0 : Wend
- LINE$(0)="Do you really"
- LINE$(1)="Want to Quit?"
- BUTTON$(0)="Byee"
- BUTTON$(1)="Cancel"
- ALERT[25,6,6,1,2,2]
- If Q=1
- End
- End If
- Return
- CLRMAP:
- LINE$(0)="What Tile do you want"
- LINE$(1)="the map cleared to ?"
- BUTTON$(0)="Tile 0"
- BUTTON$(2)="Cancel"
- BUTTON$(1)="Current"
- While Mouse Key<>0 : Wend
- ALERT[37,6,6,1,3,2]
- If Q=1 or Q=2
- T=UTILE : If Q=1
- T=0
- End If
- Menu Off
- Screen 0
- Locate 0,10 : Paper 2 : Pen 0 : Centre "Clearing Map "
- Locate 0,11 : Centre " Please Wait "
- A=0 : Repeat
- B=0 : Repeat
- Poke Start(6)+4+A*MAPX+B,T
- Inc B
- Until B=MAPX
- Inc A
- Until A=MAPY
- Screen 1
- Menu On
- End If
- Return
- SIZEMAP:
- Get Block 241,0,2,320,66
- Ink 1,4
- Set Paint 1
- Bar 10,2 To 116,66
- Bar 120,2 To 260,66
- Ink 4
- Box 12,4 To 114,64
- Box 122,4 To 258,64
- Ink 0
- Paper 1 : Pen 4
- Locate 17,5 : Print Zone$(Border$("O.K",1),2)
- Locate 24,5 : Print Zone$(Border$("Cancel",1),3)
- Set Paint 0
- Set Zone 1,12,4 To 113,63
- OK=0
- MX=MAPX : MY=MAPY : MXO=MX : MYO=MY
- While OK=0
- Ink 0,1
- Text 126,14,"Xsize:"+Right$(" "+Str$(MX),3)
- Text 126,24,"Ysize:"+Right$(" "+Str$(MY),3)
- Ink 1
- Box 12,4 To 11+MXO/2,3+MYO/2
- Ink 4
- Box 12,4 To 114,64
- Box 12,4 To 11+MX/2,3+MY/2
- MXO=MX : MYO=MY
- While Mouse Key=0 : Wend
- While Mouse Key<>0 : Wend
- Z=Mouse Zone
- If Z=2
- OK=1
- End If
- If Z=1
- MX=Max(SCW/XSIZE,2*(X Screen(X Mouse)-12))
- MY=Max(SCH/YSIZE,2*(Y Screen(Y Mouse)-4))
- End If
- If Z=3
- OK=2
- End If
- Wend
- Put Block 241,0,2
- Del Block 241
- If OK=1
- MAPX=Deek(Start(6)) : MAPY=Deek(Start(6)+2)
- S6=Start(6)+MAPX*MAPY+4
- TLX=Deek(S6+4) : TLY=Deek(S6+6)
- TAMEW=Deek(S6+8) : TAMEH=Deek(S6+10)
- BRX=Deek(S6+12) : BRY=Deek(S6+14)
- MAPX=MX : MAPY=MY
- Erase 6
- Reserve As Work 6,MAPX*MAPY+20
- Doke Start(6),MAPX : Doke Start(6)+2,MAPY
- S6=Start(6)+4+MAPX*MAPY
- Doke S6,XSIZE : Doke S6+2,YSIZE
- Doke S6+4,TLX : Doke S6+6,TLY
- Doke S6+8,TAMEW : Doke S6+10,TAMEH
- Doke S6+12,BRX : Doke S6+14,BRY
- M$="TAME Map"
- A=0 : Repeat : Poke Start(6)-8+A,Asc(Mid$(M$,A+1,1)) : Inc A : Until A=8
- Curs Off
- Gosub CLRMAP
- End If
- Return
- FXTILE:
- X=X Screen(X Mouse)/XSIZE
- Y=Y Screen(Y Mouse)/YSIZE
- If(X+SCX<MAPX) and(Y+SCY<MAPY)
- Poke Start(6)+4+(SCY+Y)*MAPX+(SCX+X),UTILE
- TEMP=Screen
- Screen 0
- Cls 0,X*XSIZE,Y*YSIZE To(X+1)*XSIZE,(Y+1)*YSIZE
- Put Block UTILE+1,X*XSIZE,Y*YSIZE
- Screen TEMP
- End If
- Return
- FXBX:
- X=X Screen(X Mouse)/XSIZE
- Y=Y Screen(Y Mouse)/YSIZE
- If(X+SCX<MAPX) and(Y+SCY<MAPY)
- If MDE>2
- Gosub BLKMDE
- Else
- Poke Start(6)+4+(SCY+Y)*MAPX+(SCX+X),UTILE
- TEMP=Screen
- Screen 0
- Cls 0,X*XSIZE,Y*YSIZE To(X+1)*XSIZE,(Y+1)*YSIZE
- Put Block UTILE+1,X*XSIZE,Y*YSIZE
- Screen TEMP
- If MDE=1
- MDE=2 : BTLX=X+SCX : BTLY=Y+SCY : While Mouse Key<>0 : Wend
- SETAUTO
- Else
- MDE=1
- A=0 : Repeat
- B=0 : Repeat
- Poke Start(6)+4+(A+BTLY)*MAPX+(B+BTLX),UTILE
- Inc B : Until B+BTLX>X+SCX
- Inc A : Until A+BTLY>Y+SCY
- NM=1
- While Mouse Key<>0 : Wend
- SETAUTO
- End If
- End If
- End If
- While Mouse Key<>0 : Wend
- Return
- Procedure PICKTILE
- Shared A,NM,XSIZE,YSIZE,UTILE,MXLN
- Amal Freeze
- Sprite Off 8
- Show On
- Menu Off
- Screen 2
- Cls 2
- SCW=Deek(Screen Base+76)
- SCH=Deek(Screen Base+78)
- X=SCW/XSIZE
- Y=SCH/YSIZE
- Cls 0
- Ink 1
- A=0 : Repeat
- B=0 : Repeat
- Put Block A*X+B+1,B*XSIZE,A*YSIZE
- Inc B : Until B=X
- Inc A : Until A>=Y or A>MXLN
- A=0 : Repeat : Draw 0,A*YSIZE To SCW,A*YSIZE
- Inc A
- Until A=Y
- A=0 : Repeat : Draw A*XSIZE,0 To A*XSIZE,SCH
- Inc A : Until A=X
- Screen Copy 2 To 0
- Screen 0
- While Mouse Key=0 : Wend
- X2=X Screen(X Mouse)/XSIZE : Y2=Y Screen(Y Mouse)/YSIZE
- UTILE=Y2*X+X2
- UTILE=Min((MXLN+1)*X-1,UTILE)
- Screen 2
- GRABCURSOR
- Screen 0
- Menu On
- Cls 0
- End Proc
- Procedure TITLEBAR
- Shared C(),C2(),B,T,D,C
- Hide On
- Auto View Off
- Unpack 7 To 2
- Get Icon 1,0,18 To 32,27
- Get Sprite 1,32,28 To 48,44
- A=0 : Repeat
- Get Sprite A+2,A*16,28 To A*16+16,44
- Hot Spot A+2,$11
- Inc A
- Until A=3
- Screen Display 2,,48,,16
- Ink 0
- Bar 0,28 To 320,200
- A=0 : Repeat : C(A)=Colour(A) : C2(A)=0 : Inc A : Until A=8
- Fade 1
- CPAUSE[1,0]
- Auto View On
- Screen To Front 2
- B=0 : T=0
- While B<>999
- Read B,B2
- If B<>999
- C2(B)=$FFF : C2(B2)=$FFF
- OT=T
- While T<OT+2
- NEATFADE
- Inc T
- Wend
- End If
- Wend
- OT=T : D=6
- While T<OT+D
- NEATFADE
- Inc T
- Wend
- Colour 1,$FFF
- Data 4,4,3,5,2,6,7,7,999,999
- End Proc
- Procedure CPAUSE[C,C2]
- While Colour(C)<>C2 : Wend
- End Proc
- Procedure NEATFADE
- Shared C(),C2(),C3(),GTG
- Dim R(5)
- A=0 : Repeat
- CO=Colour(A)
- R(0)=CO/256
- R(1)=(CO mod 256)/16
- R(2)=CO mod 16
- R(3)=C2(A)/256
- R(4)=(C2(A) mod 256)/16
- R(5)=C2(A) mod 16
- R=0 : Repeat
- If R(R)<R(R+3)
- R(R)=R(R)+3 : R(R)=Min(R(R),R(R+3))
- End If
- If R(R)>R(R+3)
- R(R)=R(R)-3 : R(R)=Max(R(R),R(R+3))
- End If
- Inc R
- Until R=3
- CO=R(0)*256+R(1)*16+R(2)
- Colour A,CO
- If CO=$FFF
- C2(A)=C(A)
- C3(A)=1
- End If
- Inc A
- Until A=8
- End Proc
- Procedure MAKEICONS
- Ink 6,1
- Set Paint 1
- Set Pattern 30
- Cls 1
- Bar 0,0 To 15,15 : Get Icon 2,0,0 To 16,16
- Cls 1
- Bar 0,0 To 31,15
- Get Icon 3,0,0 To 32,16
- Cls 1
- Bar 0,0 To 15,31
- Get Icon 4,0,0 To 16,32
- Cls 1
- Bar 0,0 To 31,31
- Get Icon 5,0,0 To 32,32
- Set Pattern 0
- Set Paint 0
- End Proc
- Rem alert box routine without using the window commands
- Rem uses the arrays line$() and button$()
- Rem returns button pressed in Q
- Procedure ALERT[W,H,C1,C2,NB,NL]
- Shared LINE$(),BUTTON$(),Q
- A=1 : Repeat
- Reset Zone A
- Inc A
- Until A=4
- W=W*8
- H=H*8
- X=160-W/2
- Y=35-H/2
- Get Block 241,0,Y,320,H+6
- Ink 0
- Bar X+5,Y+5 To X+W+5,Y+H+5
- Ink C1
- Bar X,Y To X+W,Y+H
- Ink C2
- Box X+1,Y+1 To X+W-1,Y+H-1
- S=W/8/(NB+1)+1
- If NB=1
- S=4
- End If
- Paper C1
- Pen C2
- A=0 : While A<NL
- Locate 0,Y Text(Y)+1+A
- Centre LINE$(A)
- Inc A
- Wend
- A=0 : While A<NB
- Locate X Text(X)+S/2+S*A,Y Text(Y+H)-2
- Print Border$(Zone$(BUTTON$(A),A+1),2);
- Inc A : Wend
- Q=0 : While Q<1 or Q>NB
- While Mouse Key=0 : Wend
- Q=Mouse Zone
- Wend
- Put Block 241,0,Y
- Del Block 241
- End Proc
- Procedure GRABCURSOR
- Shared XSIZE,YSIZE,UTILE,MXLN
- UTILE=Min(MXLN*320/XSIZE-1,UTILE)
- Screen 2
- A=1 : C=Colour(0) : Repeat : If Hex$(Colour(A))>Hex$(C)
- Ink A
- End If
- Inc A : Until A=32
- Put Block UTILE+1,0,0
- Box 0,0 To XSIZE-1,YSIZE-1
- Get Sprite 1,0,0 To XSIZE,YSIZE
- Hot Spot 1,$11
- SETAUTO
- Screen 0
- End Proc
- Rem TAME Engine Routines
- Rem use these in your own programs if you wish (see MAGIC FOREST)
- Procedure GTBLCKS
- Rem This routine converts a screen (screen 2) into icons for use by TAME
- Rem XSIZE & YSIZE determine the block size (and thus the number of them)
- Shared XSIZE,YSIZE,XSO,YSO,ICDONE,NCOLS,REZ,SCW,SCH,MXLN
- Screen 0
- Get Palette(2)
- If ICDONE
- Screen 2
- A=Screen Base+72
- SCW=Deek(A+4)
- SCH=Deek(A+6)
- NCOLS=Deek(A+24)
- Cls 2
- A=0 : Repeat
- B=0 : Repeat
- Put Block A*(SCW/XSO)+B+1,B*XSO,A*YSO
- Inc B
- Until B>=SCW/XSO
- Inc A
- Until A>=SCH/YSO or A>MXLN
- Del Block
- End If
- Screen 2
- XSO=XSIZE
- YSO=YSIZE
- A=0
- Repeat
- B=0
- Repeat
- Get Block A*(SCW/XSIZE)+B+1,B*XSIZE,A*YSIZE,XSIZE,YSIZE
- Inc B
- Until B>=SCW/XSIZE
- Inc A
- Until A>=SCH/YSIZE or A>MXLN
- Screen 0
- GRABCURSOR
- ICDONE=1
- Cls 0
- End Proc
- Procedure TAMEVIEW[TX,TY,TW,TH,XS,YS]
- Rem This routine sets up the window for TAME, and what size tiles you wish
- Rem to use
- Shared XSIZE,YSIZE,MAPX,MAPY,TAMEW,TAMEH,TLX,TLY,BRX,BRY
- M$="TAME Map"
- MAPX=Deek(Start(6)) : MAPY=Deek(Start(6)+2)
- XSIZE=XS : YSIZE=YS
- TLX=TX : TLY=TY
- TAMEW=TW : TAMEH=TH
- BRX=TLX+TW*(XSIZE-1)
- BRY=TLY+TH*(YSIZE-1)
- S6=Start(6)+4+MAPX*MAPY
- Doke S6,XSIZE : Doke S6+2,YSIZE
- Doke S6+4,TLX : Doke S6+6,TLY
- Doke S6+8,TAMEW : Doke S6+10,TAMEH
- Doke S6+12,BRX : Doke S6+14,BRY
- A=0 : Repeat : Poke Start(6)-8+A,Asc(Mid$(M$,A+1,1)) : Inc A : Until A=8
- End Proc
- Procedure TAMEMAP[S,X,Y]
- Rem This routine draws the map in the window set by the TAMEVIEW procedure
- Rem on screen S, at map co-ordinates X,Y
- Shared XSIZE,YSIZE,TLX,TLY,TAMEW,TAMEH,BRX,BRY,MXLN
- MXTOS=MXLN*320/XSIZE-1
- MAPX=Deek(Start(6)) : MAPY=Deek(Start(6)+2)
- S6=Start(6)+MAPX*MAPY+4
- XSIZE=Deek(S6) : YSIZE=Deek(S6+2)
- TLX=Deek(S6+4) : TLY=Deek(S6+6)
- TAMEW=Deek(S6+8) : TAMEH=Deek(S6+10)
- BRX=Deek(S6+12) : BRY=Deek(S6+14)
- TEMP=Screen
- Screen S
- S6=Start(6)+4
- WI=TAMEW*XSIZE
- HI=TAMEH*YSIZE
- MAPZ=MAPX*MAPY
- A=0 : A2=Y*MAPX
- Repeat
- A2=A2 mod MAPZ
- B=0 : B2=X
- Repeat
- Put Block 1+Min(MXTOS,Peek(S6+(B2 mod MAPX)+A2)),TLX+B,TLY+A
- Add B,XSIZE : Inc B2
- Until B>=WI
- Add A,YSIZE : Add A2,MAPX
- Until A>=HI
- Screen Copy S,TLX,TLY,BRX,BRY To TEMP,TLX,TLY
- Screen TEMP
- End Proc
- Procedure CREDITS
- Shared LINE$(),BUTTON$()
- LINE$(0)="Tame Map Editor"
- LINE$(1)="(c) Mandarin/Jawx 1990"
- LINE$(2)=" By Shadow Software"
- LINE$(3)=" Version 1.0"
- BUTTON$(0)="O.K"
- ALERT[36,6,7,1,1,4]
- End Proc
- Procedure CLRTXT
- Ink 6 : Bar 0,28 To 320,90
- Ink 6 : Bar 1,29 To 80,88
- Ink 5 : Polyline 80,29 To 1,29 To 1,88
- Ink 0 : Polyline 80,30 To 80,88 To 1,88
- Ink 6 : Bar 81,29 To 158,88
- Ink 5 : Polyline 158,29 To 81,29 To 81,88
- Ink 0 : Polyline 158,30 To 158,88 To 81,88
- End Proc